using Abp.Domain.Services;
using SOEI.Solution.DomainEntities.ContractManagement;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion.Internal;

namespace SOEI.Solution.DomainEntities.RegulatoryMange.DomainService
{
    /// <summary>
    /// 领域服务接口定义
    ///</summary>
    public interface IAgreementManager : IDomainService
    {
		#region -------------------------------------------------辅助工具生成----------------------------------------------
		/// <summary>
		/// 返回表达式数的实体信息即IQueryable类型(可选择部分字段)
		/// </summary>
		/// <returns>IQueryable</returns>
		IQueryable<ViewAgreement> QueryEntityListAsNoTracking();
		/// <summary>
		/// 返回表达式数的实体信息即IQueryable类型
		/// </summary>
		/// <returns>IQueryable</returns>
		IQueryable<Agreement> Query();
		/// <summary>
		/// 返回性能更好的IQueryable类型，但不包含EF Core跟踪标记
		/// </summary>
		/// <returns>IQueryable</returns>
		IQueryable<Agreement> QueryAsNoTracking();
		/// <summary>
		/// 【Agreement】根据Id查询实体信息
		/// </summary>
		/// <param name="id"></param>
		/// <returns>实体</returns>
		Task<Agreement> FindByIdAsync(string id);
		/// <summary>
		/// 【Agreement】检查实体是否存在
		/// </summary>
		/// <returns>是否成功</returns>
		Task<bool> IsExistAsync(string id);
		/// <summary>
		/// 【Agreement】添加实体
		/// </summary>
		/// <param name="entity">实体</param>
		/// <returns></returns>
		Task<Agreement> CreateAsync(Agreement entity);
		/// <summary>
		/// 【Agreement】修改实体
		/// </summary>
		/// <param name="entity">实体</param>
		/// <returns></returns>
		Task UpdateAsync(Agreement entity);
		/// <summary>
		/// 【Agreement】删除实体
		/// </summary>
		/// <param name="id"></param>
		/// <returns></returns>
		Task DeleteAsync(string id);
		/// <summary>
		/// 【Agreement】批量删除
		/// </summary>
		/// <param name="input">Id的集合</param>
		/// <returns></returns>
		Task BatchDelete(List<string> input);

		#endregion

        #region -------------------------------------------------用户自定义------------------------------------------------

        /*请在此扩展领域服务接口*/

        DateTime FindSysDate();

        string GetAgreementChangeId();

        string GetAgreementId();

        string GetAgreementBothId();

        Task<string> GetAgreementRegId();

        IQueryable<Regulator> QueryAllRegulator();

        IQueryable<RegulatoryAccount> QueryAllRegulatoryAccount();

        Task<ContractSummary> FindContractAsync(Expression<Func<ContractSummary, bool>> predicate);

        Task<bool> IsExistTreatyAgreement(string pContractId, string pAgreementId);

        Task<bool> IsExistNoTreatyAgreement(string pContractId, string pAgreementId);

        Task<Agreement> GetForEditAsync(string pAgreementId);

        Task<AgreementChange> SaveAgreementChange(AgreementChange entity);

        Task<AgreementBoth> CreateAsyncAgreementBoth(AgreementBoth entity);

        IQueryable<ContractBoth> QueryContractBoth();

        IQueryable<AgreementBoth> QueryAgreementBoth();

        Task SubmitAgreement(string id);

		Task<AgreementChange> UpdateAgreementChange(AgreementChange entity);

        Task<AgreementChange> GetAgreementChangeAsync(string key);

		Task<bool> CheckAgreementAny(Expression<Func<Agreement, bool>> expression);

		Task<AgreementChange> FindAgreementChangeAsync(Expression<Func<AgreementChange, bool>> expression);

		/// <summary>提交监管协议变更信息
		/// </summary>
        Task SubmitAgreementChange(string id);

		/// <summary>检查监管协议变更信息
		/// </summary>
        Task<bool> CheckAgreementChangeAny(Expression<Func<AgreementChange, bool>> expression);

        #endregion
    }
}
